package com.personal.dao;

import com.personal.domain.Industry;
import com.personal.util.partDisplay.IndustryPart;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @projectName: smartCommunity_springboot
 * @package: com.personal.dao
 * @className: IndustryDao
 * @author: bong~
 * @description: TODO
 * @date: 2023/8/11 11:03
 * @version: 1.0
 */

@Mapper
public interface IndustryDao {


    @Select("select * from industryinformation")
    List<Industry> selectAll();

    @Select("select * from industryinformation")
    List<IndustryPart> selectPartAll();

    @Select("select * from industryinformation where industryId=#{industryId}")
    IndustryPart selectPartById(int industryId);

    @Select("select * from industryinformation where industryCategoryName like CONCAT('%',#{name},'%')")
    List<IndustryPart> selectPartByKey(String name);



    @Select("select * from  industryinformation where parentId is null")
    List<Industry> selectByParentIdNull();
    @Select("select * from industryinformation where parentId = #{parentId}")
    List<Industry> selectByParentId(int parentId);




    @Insert("insert into industryinformation (industryId, parentId, industryCategoryName, forbidden, remark, path) values " +
            "(#{industryId},#{parentId},#{industryCategoryName},#{forbidden},#{remark},#{path})")
    int add(Industry industry);

    @Select("select * from industryinformation where industryId=#{industryId}")
    Industry getUpdateData(int industryId);
    @Update("update industryinformation set industryCategoryName=#{industryCategoryName},forbidden=#{forbidden},remark=#{remark}")
    int update(Industry industry);

    @Delete("delete from industryinformation where industryId=#{industryId}")
    int delete(int industryId);

}
